package thread;

public class SyncDemo3 {
    public static void main(String[] args) {
        Boo b1=new Boo();
        Boo b2=new Boo();
       /* Thread t1=new Thread(()->b1.doSome());
        Thread t2=new Thread(()->b2.doSome());
        */
        Thread t1=new Thread(()->Boo.doSome());
        Thread t2=new Thread(()->Boo.doSome());
        t1.start();
        t2.start();
    }
}

class Boo{
    public static void doSome(){
        synchronized (Boo.class){
        try {
            Thread t = Thread.currentThread();
            System.out.println("执行doSome方法的线程是："+t);
            Thread.sleep(5000);
            System.out.println("执行doSome方法结束");
        } catch (InterruptedException e) {
        }
    }
    }
}